package site.mypage.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import site.member.dao.MemberDao;
import site.member.dao.MemberDaoImpl;
import site.member.domain.MemberCommand;
import site.member.validator.MemberLoginValidator;

@Controller
public class MyPageController {
	@Autowired
	private MemberDao memberDao;
	public void setMemberDao(MemberDao memberDao) {this.memberDao = memberDao;}
	
	@RequestMapping("mypage/info.do")
	public ModelAndView Userinfo(HttpServletRequest request){
		
		HttpSession session = request.getSession();
		String id = (String) session.getAttribute("sid");
				
		MemberCommand command = memberDao.getUserData(id);
		
		return new ModelAndView("MyPage","userdata",command);
	}
}